0%

LAMMPS | Build LAMMPS with VORONOI package

Quick Start

在未名超算,执行以下命令即可,其他超算平台类似。

1
2
3
4
5
6
7
8
9
module add gcc/7.2.0  intel/2017.1  mpich/3.2.1-intel-2017.1	#添加模块

cd lammps/src #切换到lammps/src目录下
make make lib-voronoi args="-b" #安装voronoi库。此时切到lib/voronoi目录下,会看到两个动态链接,如下图所示。

cd lammps/src #切换到lammps/src目录下
make ps #查看当前已经安装的包
make yes-VORONOI #添加VORONOI包
make mpi #编译生成可执行文件lmp_mpi

Full Instructions

We use traditional make.

To build with this package, you must download and build the Voro++ library.
You can download and build the Voro++ library manually if you prefer; follow the instructions in lib/voronoi/README. You can also do it in one step from the lammps/src dir, using a command like these, which simply invoke the lib/voronoi/Install.py script with the specified args:

1
2
3
4
make lib-voronoi                          # print help message
make lib-voronoi args="-b" # download and build the default version in lib/voronoi/voro++-<version>
make lib-voronoi args="-p $HOME/voro++" # use existing Voro++ installation in $HOME/voro++
make lib-voronoi args="-b -v voro++0.4.6" # download and build the 0.4.6 version in lib/voronoi/voro++-0.4.6

Note that 2 symbolic (soft) links, “includelink” and “liblink”, are created in lib/voronoi to point to the Voro++ src dir. When LAMMPS builds in src it will use these links. You should not need to edit the lib/voronoi/Makefile.lammps file.
liblink

The README in src/VORONOI

The VORONOI package adds a compute voronoi/atom command which calculates a Voronoi tesselation of the system.

It uses the Voro++ library, available at http://math.lbl.gov/voro++/ to compute the tesselation locally on each processor. Voro++ was developed by Chris H. Rycroft while at UC Berkeley / Lawrence Berkeley Laboratory.

That library can be downloaded and built in lib/voronoi or elsewhere on your system, which must be done before bulding LAMMPS with this package. Details of the download, build, and install process for Voro++ are given in the lib/voronoi/README file, and scripts are provided to help automate the process. Also see the LAMMPS manual for general information on building LAMMPS with external libraries. The settings in the Makefile.lammps file in lib/voronoi must be correct for LAMMPS to build correctly with this package installed.

Once you have successfully built LAMMPS with this package and Voro++, you can test it using an input file from the examples dir:

1
2
./lmp_serial < lammps/examples/voronoi/in.voronoi | grep '^TEST_'
./lmp_serial < ./voronoi/in.voronoi

The output should conclude with ‘TEST_DONE’ and every line should report an error of 0%.

== Credits and license ==

This compute was written by Daniel Schwen (daniel@schwen.de) and is licensed under the GPLv2 license.

Please contribute changes back to the community.

The README in lib/voronoi

This directory contains links to the Voro++ library which is required to use the VORONOI package and its compute voronoi/atom command in a LAMMPS input script.

The Voro++ library is available at http://math.lbl.gov/voro++ and was developed by Chris H. Rycroft while at UC Berkeley / Lawrence Berkeley Laboratory.

You can type “make lib-voronoi” from the src directory to see help on how to download and build this library via make commands, or you can do the same thing by typing “python Install.py” from within this directory, or you can do it manually by following the instructions below.


Instructions:

  1. Download Voro++ at http://math.lbl.gov/voro++/download
    either as a tarball or via SVN, and unpack the
    tarball either in this /lib/voronoi directory
    or somewhere else on your system.

  2. Compile Voro++ from within its home directory
    % make

  3. There is no need to install Voro++ if you only wish
    to use it from LAMMPS. You can install it if you
    wish to use it stand-alone or from other codes:
    a) install under the default /usr/local
    % sudo make install
    b) install under a user-writeable location by first

    changing the PREFIX variable in the config.mk file, then

    % make install

  4. Create two soft links in this dir (lib/voronoi)
    to the Voro++ src directory is. E.g if you built Voro++ in this dir:
    % ln -s voro++-0.4.6/src includelink
    % ln -s voro++-0.4.6/src liblink
    These links could instead be set to the include and lib
    directories created by a Voro++ install, e.g.
    % ln -s /usr/local/include includelink
    % ln -s /usr/local/lib liblink


When these steps are complete you can build LAMMPS with the VORONOI package installed:

1
2
3
cd lammps/src
make yes-voronoi
make g++ (or whatever target you wish)

Note that if you download and unpack a new LAMMPS tarball, the “includelink” and “liblink” files will be lost and you will need to re-create them (step 4). If you built Voro++ in this directory (as opposed to somewhere else on your system) and did not install it somewhere else, you will also need to repeat steps 1,2,3.

The Makefile.lammps file in this directory is there for compatibility with the way other libraries under the lib dir are linked with by LAMMPS. However, Voro++ requires no auxiliary files or settings, so its variables are blank.

治bug者

出错原因有二
1.没有加载模块。执行module add mpi/mpich/3.2.1 intel/2018.0 gcc/6.4.0后,无法并行编译的问题解决。
2.没有安装python

1
2
3
4
5
6
7
8
9
10
11
.
.
.
mpicxx -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I../../lib/voronoi/includelink -DLMP_PYTHON -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -c ../fix_python_invoke.cpp
../fix_python_invoke.cpp:18:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
make[1]: *** [fix_python_invoke.o] Error 1
make[1]: Leaving directory `/nfs-share/home/1701110088/apps/lammps/src/Obj_mpi'
make: *** [mpi] Error 2

由于lammps只能使用python2,所以通过module anacode/2.5.2加载python模块。

然后make mpi,结果又出现了下面bug:

1
2
3
4
5
6
7
8
.
.
.
/usr/bin/ld: cannot find -lpython2.7
collect2: error: ld returned 1 exit status
make[1]: *** [../lmp_mpi] Error 1
make[1]: Leaving directory `/nfs-share/home/1701110088/apps/lammps/src/Obj_mpi'
make: *** [mpi] Error 2

第二天,才发现,是PYTHON包的原因,在src中卸载该包,再次编译,成功!!!

原因回顾:并不因为VORONOI包的原因,而是PYTHON包的原因。我感觉即使是加载了ANACODA,也没有调用成功python。需要联系超算管理员给权限安装python。